<?php
/*
 * 手机客户端 店铺-商品留言接口
 * 传入参数 
 * 2014-02-26
 * 2014-05-08 (已查) 
 */
include "inc/public_header.php";
 
include "func/user.php";				//用户信息处理函数

$reJson = array();//构建返回值
 
$content 		= $_REQUEST["content"];		//用户提交内容
$msgId 			= $_REQUEST["msgId"];		//留言主键
$goodsId		= $_REQUEST["goodsId"];		//商品id

//获取用户信息
$uInfoArr = user_getInfoFromUUID();
if(!$uInfoArr && $msgId){
	echo json_encode(array("success"=>"0","errCode"=>"0","msg"=>"没有获取到用户信息"));
	die;
}
$uid = $uInfoArr["uid"];//用户信息主键


if(!$msgId){
//提交留言
if(!$uInfoArr){
$sql = "insert into shop_product_liuyan (pid,msg,type,ctime) values('".$goodsId."','".$content."','1',now())";
$db->query($sql);
}else{
$sql = "insert into shop_product_liuyan (uid,pid,msg,type,ctime) values('".$uid."','".$goodsId."','".$content."','1',now())";
$db->query($sql);
}
$ids=$db->insert_id();
$sql = "update shop_product_liuyan set lid='".$ids."' where id='".$ids."'";
$db->query($sql);
}else{
//提交回复
$sql = "insert into shop_product_liuyan (lid,uid,pid,msg,type,ctime) values('".$msgId."','".$uid."','".$goodsId."','".$content."','0',now())";
$db->query($sql);
}
$reJson["success"] = "1";
echo json_encode($reJson);
?>